package com.helei.controller;


import java.util.*;

/**
 * @ Author：hl
 * @ Date：2024-09-29-16:18
 */
public class test {
    static String[] suits = {"梅花", "方块", "红桃", "黑桃"};
    static String[] ranks = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
    public static final Map<String, Integer> map_constant;
    public static List<String> listS;

    static {
        Map<String, Integer> map = new HashMap<>();
        map.put("2", 2);
        map.put("3", 3);
        map.put("4", 4);
        map.put("5", 5);
        map.put("6", 6);
        map.put("7", 7);
        map.put("8", 8);
        map.put("9", 9);
        map.put("10", 10);
        map.put("J", 11);
        map.put("Q", 12);
        map.put("K", 13);
        map.put("A", 15);
        map_constant = map;
    }

    static {
        List<String> list = new ArrayList<>();
        for (String s : suits) {
            for (String y : ranks) {
                list.add(s + y);
            }
        }
        listS = list;
    }

    /**
     * 判断
     *
     * @return
     */
    private String judgement1() {
        return "";
    }

    public static void main(String[] args) {
        Collections.shuffle(listS);
        List<String> list = new ArrayList<>();
        list.add("玩家1");
        list.add("玩家2");
        list.add("玩家3");
        list.add("玩家4");
        list.add("玩家5");
        System.out.println("开始每个人发3张");
        System.out.println("------------");
        Map<String, List<String>> map = new HashMap<>();
        int index = 0;
        for (int i = 0; i < 5; i++) {
            if (i <= 2) {
                for (String f : list) {
                    List<String> stringList = map.get(f);
                    if (stringList == null) {
                        stringList = new ArrayList<>();
                    }
                    stringList.add(listS.get(index));
                    map.put(f, stringList);
                    index++;
                }

            }
            if (i == 2) {
                System.out.println(map);
                System.out.println("开始池牌发3张");
                List<String> stringList = new ArrayList<>();
                stringList.add(listS.get(index));
                index++;
                stringList.add(listS.get(index));
                index++;
                stringList.add(listS.get(index));
                index++;
                map.put("池牌", stringList);
                System.out.println(stringList);
            }

        }

    }
}




